# 导包
import requests
import config


# 组织架构接口类
class DeptAPI:

    # 获取部门
    def insert_dept(self, token666):
        return requests.get(url=f"{config.BASE_URL}/api/company/department", headers={"Authorization": token666})

    # 添加部门
    def add_dept(self, token666, add_data):
        return requests.post(url=f"{config.BASE_URL}/api/company/department", headers={"Authorization": token666}, json=add_data)

    # 查询部门
    def get_dept(self, id666, token666):
        return requests.get(url=f"{config.BASE_URL}/api/company/department/{id666}", headers={"Authorization":token666})

    # 修改部门
    def update_dept(self, id666, token666, update_data):
        return requests.put(url=f"{config.BASE_URL}/api/company/department/{id666}", headers={"Authorization":token666}, json=update_data)

    # 删除部门
    def delete_dept(self, id666, token666):
        return requests.delete(url=f"{config.BASE_URL}/api/company/department/{id666}", headers={"Authorization":token666})